<template>
  <el-dialog
    @close="cancel"
    :title="title"
    :visible.sync="open"
    width="660px"
    class="dialogClass"
    append-to-body
  >
    <template slot="title">
      <div class="modalTitle">
        <img
          src="@/assets/bluelogo/drawerTitle.png"
          alt=""
          class="titleLogo"
        />{{ title }}
      </div>
    </template>
    <div class="modalCard">
      <div class="titlefangkuai">
        <div class="fangkuai"></div>
        <div class="Header">申请人员基本信息</div>
      </div>

      <el-descriptions
        class="descriptions"
        label-width="120px"
        :column="2"
        size="medium"
        labelClassName="label"
        contentClassName="content"
      >
       <el-descriptions-item label="申请人姓名">{{
          this.formData.applicationName
        }}</el-descriptions-item>
        <el-descriptions-item label="申请人身份证号">
          {{ this.formData.applicationZjh }}
        </el-descriptions-item>

        <el-descriptions-item label="申请人联系电话">
          {{ this.formData.applicationTel }}
        </el-descriptions-item>
        <el-descriptions-item label="与涉案人关系">
          <dict-tag
            :options="dict.type.relation_type"
            :value="formData.applicationRelation"
          ></dict-tag>
        </el-descriptions-item>
        </el-descriptions>
    </div>
    <el-divider></el-divider>
    <div class="modalCard">
      <div class="titlefangkuai">
        <div class="fangkuai"></div>
        <div class="Header">涉案人员基本信息</div>
      </div>

      <el-descriptions
        class="descriptions"
        label-width="120px"
        :column="2"
        size="medium"
        labelClassName="label"
        contentClassName="content"
      >
        <el-descriptions-item :span="2" label="所属案件">{{
          this.formData.caseName
        }}</el-descriptions-item>
        <el-descriptions-item label="姓名">{{
          this.formData.name
        }}</el-descriptions-item>
        <el-descriptions-item label="损失金额">{{
          this.formData.personJudgmentLossAmount
        }}</el-descriptions-item>
        <el-descriptions-item label="身份证号">{{
          this.formData.zjh
        }}</el-descriptions-item>
        <el-descriptions-item label="电话">{{
          this.formData.tel
        }}</el-descriptions-item>
      </el-descriptions>
      <el-descriptions
        class="descriptions"
        label-width="120px"
        :column="1"
        size="medium"
        labelClassName="label"
        contentClassName="content"
      >
        <el-descriptions-item label="户籍地址">{{
          this.formData.residenceAddress
        }}</el-descriptions-item>
        <el-descriptions-item label="居住地址">{{
          this.formData.oucodeName
        }}</el-descriptions-item>
      </el-descriptions>
      <el-descriptions
        class="descriptions"
        label-width="120px"
        :column="1"
        size="medium"
        labelClassName="label"
        contentClassName="content"
      >
        <el-descriptions-item label="具体地址">{{
          this.formData.specificAddress
        }}</el-descriptions-item>
      </el-descriptions>
    </div>
    <el-divider></el-divider>
    <div class="modalCard">
      <div class="titlefangkuai">
        <div class="fangkuai"></div>
        <div class="Header">涉案人员人员类型</div>
      </div>

      <el-descriptions
        class="descriptions"
        label-width="120px"
        :column="1"
        size="medium"
        labelClassName="label"
        contentClassName="content"
      >
        <el-descriptions-item label="人员类型">{{
          this.formData.tagTypeName
        }}</el-descriptions-item></el-descriptions
      >
    </div>
    <div slot="footer">
      <div class="dialog-footer">
        <el-button @click="cancel" class="resetButton"> 关闭 </el-button>
      </div>
    </div>
  </el-dialog>
</template>
<script>
import { MODALTYPE, MODALIMG, CASEDEFAULTSTATE } from "../../../utils/variable";
import { onlyNumber } from "../../../utils/commonMethods";
import { getDetail } from "@/api/invovedPerson/invovedPerson.js";
import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
import {
  getCase,
  addCase,
  getTree,
  validNumber,
  updateCase,
} from "@/api/caseManage/case";
export default {
  dicts: ["relation_type"],
  inheritAttrs: false,
  components: { Treeselect },
  props: {
    detailId: {
      type: Number,
      require: true,
    },
    detailCaseId: {
      type: Number,
      require: true,
    },
  },
  data() {
    return {
      // 弹出层标题
      title: "",
      // 部门树选项
      deptOptions: [],
      // 是否显示弹出层
      open: false,
      formData: {
        caseName: "",
        name: "",
        zjh: "",
        tel: "",
        involvedPeople: "",
        residenceAddress: "",
        liveAddress: "",
      },
    };
  },
  computed: {},
  watch: {
    detailId: {
      handler(value) {
        if (value) {
          this.reset();
          getDetail(value, this.detailCaseId).then((response) => {
            this.formData = response.data;
            this.open = true;
            this.title = "涉案人员详情";
          });
          console.log(value);
        }
      },
      immediate: true,
    },
  },
  created() {},
  mounted() {},
  methods: {
    onlyNumber,
    // 取消按钮
    cancel() {
      this.$emit("update:detailId", 0);
      this.open = false;
      this.reset();
    },

    // 表单重置
    reset() {
      this.formData = {
        caseName: "",
        name: "",
        zjh: "",
        tel: "",
        involvedPeople: "",
        residenceAddress: "",
        liveAddress: "",
      };
      this.resetForm("form");
    },
  },
};
</script>
<style lang="scss" scoped>
@import "../../../assets/styles/dialog.scss"; //模态框样式

::v-deep .label {
  width: 120px;
  font-size: 14px;
  font-family: Microsoft YaHei;
  font-weight: 700;
  color: #5e5f61;
  display: inline-block;
  text-align: right;
}
::v-deep .content {
  font-size: 14px;
  font-family: Microsoft YaHei;
  font-weight: 400;
  color: #aeafb0;
}
::v-deep .el-descriptions-item__container {
  margin-bottom: 15px;
}
.dialogClass {
  ::v-deep .el-dialog {
    top: 80px;
  }
}
</style>
